<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.4.1.min.js"></script>
</head>
<body>

<form>
    <input type="file" id="file" name="file">
    <input type="button" value="上传.." onclick="uploadFile()">
</form>
<div id="result"></div>
<script>
    function uploadFile() {
        var file = $("#file")[0].files[0];
        var formData = new FormData();
        formData.append("file", file);
        $.ajax({
           type: 'post',
           url: '/upload',
           processData: false,
           contentType: false,
            data: formData,
            success: function (msg) {
                $("#result").html("<img src='" + msg + "'>");
            }
        });
    }
</script>
</body>
</html>